/**
 * Copyright (C), 2015-2019, XXX有限公司
 * FileName: BpcMaster
 * Author:   Administrator
 * Date:     2019/7/2 16:13
 * Description: 建档主数据
 * History:
 * <author>          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 */
package com.sunlord.dto;

/**
 * 〈一句话功能简述〉<br> 
 * 〈建档主数据〉
 *
 * @author Administrator
 * @create 2019/7/2
 * @since 1.0.0
 */
public class BpcMaster {

    public static final String BPC_MASTER_COLUM = "OBJECTID,PARENTOBJECTID,MODIFIEDBY, MODIFIEDTIME, BCGCOD, YBPCBUSTYP_XS, YBPUSR, TSCCOD_4_XS, YREPSCALE, YINVOICEBNK,  YINDDET1_XS, OSTAUZW, BPCSTA, YREGFUND, YREFOSTAUZ, YBILLREQ, YFACTORYM, YBPRNAMEN, YBPCU, YPROVINCE, YREGSTARTD, YNXETYEAR, YFCY_XS, CUR, YISPRTBPCITM, CREATEDBY, YBILLCPY, YACCCHKREQ, YBILLADD, YREGENDD, YCITYZC_XS, YTRADTPYDES, YX3UPDFLG, OSTAUZ, YCITY_XS, YITMREQ, DAYMON, YPDREQ, CREATEDBYPARENTID, YBPCWY, TSCCOD, YTRUETIM, YPROVINCEZC, YCITY, YBPUSR_XS, TSCCOD_2_XS, REP_0, YOPTVAL1, REP_1, YOPTVAL2, YOPTVAL3, YPREPAID, REP_1_XS, YVMI," +
            " YCOUNRRY, CUR_XS, OWNERID, YTRADTPY_XS, TSCCOD_0, YPIO, YTRADTPY, TSCCOD_2, TSCCOD_1, TSCCOD_4, TSCCOD_3, YX3UPD, YCONTINENT_XS, YCOUNRRY_XS, TSCCOD_XS, YPROVINCE_XS, YISDISCUSTPO, YREGION, YFCY, YBILLRECTEL, YACTFUND, YPRTLBE, YINDDET4_XS, YPOSTCODE, YCONTINENTQY_XS, YPRERATE, YDOCREQ, YSWACCTEL, YBPCPAYT, YCONTINENTQY, YBPCTRUENAM, YPAYCUR, YCNPJ, YBPCBUSAGE, YSWDAYMON, PTE_XS, YINDDET4, YINDDET3, YINDDET2, CREATEDTIME, YINDDET1, YCOMPANYGRP, YCOUNTRYZC_XS, YBPCBUSTYP, YBILLBAN, PARENTPROPERTYNAME, TSCCOD_0_XS, YPROVINCEZC_XS, NAME, YBPCUSTNO, YBILLTEL, YISPCS, YKHCATEGORY," +
            " PARENTINDEX, BPRNAM, YLP, YSWACCNT,  THISLOGINNAME, YCOUNTRYZC, TSCCOD_3_XS, PRITYP, YINDDET2_XS, YBPCBUSTYPDES, YPACKREQ, BPCNUM, OWNERPARENTID, VACBPR, YFACTORYOWN, YINVSPCE, YBILLSENDADD, PTE, YISPRTCUSTPO, YBILLRECEIVE, YREGADD, YINVOICEEND, YCONTINENT, YINDDET3_XS, YRECORDFLG, BCGCOD_XS, YBUSINESSADD, YZQDAY, YTRSFRATIO, VACBPR_XS, YCOMPANYIMG,  YBUSINESSADD_XS, YREGION_XS, YCOMPANYTYP, YCITYZC, REP_0_XS, TSCCOD_1_XS, YSWPAYDAY";

    //BUSSTAMASTER, BPADDRESSMASTER, CONTACTMASTER, CRMBPCMASTER, CRMBPCITMMASTER
    public static final String BUSSTA_MASTER_COLUM = "OBJECTID,PARENTOBJECTID,PARENTPROPERTYNAME,YEARS,YQZZE,YYSZE,ZZCZZL,PARENTINDEX,ZCFZL,YZCZE,YJLR,JLRL";
    public static final String BPADDRESS_MASTER_COLUM = "OBJECTID,PARENTOBJECTID,PARENTPROPERTYNAME,STOFCY_XS,YSHFLG,BPAADDFLG_XS,STOFCY,BPAADD,BPDADD,YDEFSHFLG,BPAADDFLG,YDEFSHFLG_XS,BPCNUM,YSHFLG_XS,PARENTINDEX,YATTACHMENT";
    public static final String CONTACT_MASTER_COLUM = "OBJECTID,PARENTOBJECTID,PARENTPROPERTYNAME,CNTTTL,BPAADD,CNTLNA,CNTFNC,CNTFLG_XS,BPCNUM,YK3KCNTTEL,CCNCRM,PARENTINDEX,CNTFLG";
    public static final String CRMBPC_MASTER_COLUM = "OBJECTID,PARENTOBJECTID,PARENTPROPERTYNAME,YREMARK,YRBNAM,YRBDEC,PARENTINDEX,YRBNUM";
    public static final String CRMBPCITM_MASTER_COLUM = "OBJECTID,PARENTOBJECTID,PARENTPROPERTYNAME,YITTPROG,YREMARK,YNEXBPC,YBPNUM,PARENTINDEX";


    public static final String I_BPC_MASTER = "I_BPCMASTER";
    public static final String I_BUSSTA_MASTER = "I_BUSSTAMASTER";
    public static final String I_BPADDRESS_MASTER = "I_BPADDRESSMASTER";
    public static final String I_CONTACT_MASTER = "I_CONTACTMASTER";
    public static final String I_CRMBPC_MASTER= "I_CRMBPCMASTER";
    public static final String I_CRMBPCITM_MASTER = "I_CRMBPCITMMASTER";

    public static final String I_XS006 = "I_XS006";
    public static final String I_BUSSTA = "I_BUSSTA";
    public static final String I_BPADDRESS = "I_BPADDRESS";
    public static final String I_CONTACT = "I_CONTACT";
    public static final String I_CRMBPC = "I_CRMBPC";
    public static final String I_CRMBPCITM = "I_CRMBPCITM";

    //建档变更的表
    public static final String I_BPCCHG = "I_BPCCHG";
    public static final String I_BUSSTACHG = "I_BUSSTACHG";
    public static final String I_BPADDRESSCHG = "I_BPADDRESSCHG";
    public static final String I_CONTACTCHG = "I_CONTACTCHG";
    public static final String I_CRMBPCCHG = "I_CRMBPCCHG";
    public static final String I_CRMBPCITMCHG = "I_CRMBPCITMCHG";


    private static String getInsertSql(String t1, String t1Col, String t2Col, String t2, String whereCol, String wherePara){
        return String.format("INSERT INTO %s ( %s ) SELECT  %s FROM %s WHERE %s = '%s'",t1,t1Col,t2Col,t2,whereCol,wherePara );
    }

    public static  String getInsertBpcMasterSql (String bizObjectId){
        return getInsertSql(I_BPC_MASTER, BPC_MASTER_COLUM, BPC_MASTER_COLUM, I_XS006, "OBJECTID", bizObjectId);
    }
    public static  String getInsertBusstaMasterSql (String parentObjectId){
        return getInsertSql(I_BUSSTA_MASTER, BUSSTA_MASTER_COLUM, BUSSTA_MASTER_COLUM, I_BUSSTA, "PARENTOBJECTID", parentObjectId);
    }
    public static  String getInsertBpaddressMasterSql (String parentObjectId){
        return getInsertSql(I_BPADDRESS_MASTER, BPADDRESS_MASTER_COLUM, BPADDRESS_MASTER_COLUM, I_BPADDRESS, "PARENTOBJECTID", parentObjectId);
    }
    public static  String getInsertContactMasterSql (String parentObjectId){
        return getInsertSql(I_CONTACT_MASTER, CONTACT_MASTER_COLUM, CONTACT_MASTER_COLUM, I_CONTACT, "PARENTOBJECTID", parentObjectId);
    }
    public static  String getInsertCrmbpcMasterSql (String parentObjectId){
        return getInsertSql(I_CRMBPC_MASTER, CRMBPC_MASTER_COLUM, CRMBPC_MASTER_COLUM, I_CRMBPC, "PARENTOBJECTID", parentObjectId);
    }
    public static  String getInsertCrmbpcitmMasterSql (String parentObjectId){
        return getInsertSql(I_CRMBPCITM_MASTER, CRMBPCITM_MASTER_COLUM, CRMBPCITM_MASTER_COLUM, I_CRMBPCITM, "PARENTOBJECTID", parentObjectId);
    }


    private static  String getDeleteSql(String t1, String whereCol, String wherePara){
        return  "DELETE %s WHERE OBJECTID ='%s'";
    }

    private  static  String getUpdateSql(){

        return "";
    }








}